package com.tiancheng.trade.authserver.config;

import com.tiancheng.trade.authserver.utils.TokenGenerator;
import lombok.AllArgsConstructor;
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Author: kellen
 * @Description:
 * @Date: create in 2024/11/13 11:32
 */
@Configuration
@ConditionalOnClass({AuthConfigProperties.class})
@EnableConfigurationProperties({AuthConfigProperties.class})
@AutoConfigureAfter({AuthConfigProperties.class})
@AllArgsConstructor
public class AuhAutoConfiguration {

    private final AuthConfigProperties authConfigProperties;


    @Bean
    public TokenGenerator tokenGenerator() {
        return new TokenGenerator(this.authConfigProperties.getPrivateKey());
    }
}
